package com.google.demo.adapter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import com.google.demo.R;
import com.google.demo.model.HistoryItem;
import com.google.demo.model.HistoryItemInfo;
import com.google.demo.view.HistoryView;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class HistoryAdapter extends BaseAdapter{
	
	private Context mContext;
	private List<HistoryItem> mListHistoryItem;
	private ArrayList<HistoryItemInfo> mData;
	private LayoutInflater mLayoutInflater;

	public HistoryAdapter(Context context,List<HistoryItem> _HistoryItem) {
		// TODO Auto-generated constructor stub
		mContext = context;
		mListHistoryItem = _HistoryItem;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mListHistoryItem.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mListHistoryItem.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if(convertView == null){
			convertView = new HistoryView(mContext,mListHistoryItem.get(position));
			convertView.setClickable(true);
			convertView.setOnClickListener((HistoryView)convertView);
		}	
		return convertView;
	}
	
}

